<?php 
 	if (($format == 1) || ($format == 2)) {
		header("Pragma: public");
		header("Expires: 0");
		header("Accept-Ranges: bytes");
		header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
		if ($format == 1) {
			header("Content-Type: application/vnd.ms-word");
			header('Content-Disposition: attachment; filename=spisokprikazov.doc');
		} else {
			header("Content-Type: application/vnd.ms-excel");
			header('Content-Disposition: attachment; filename=spisokprikazov.xls');			
		}
		header("Content-Transfer-Encoding: binary");
	}
?>
<h2><?php __('Поиск по приказам');?></h2>
<table cellpadding="0" cellspacing="0" class='art-article'>
<tr>
<th>№ п/п</th>
	<th>Тип приказа</th>
	<th>Номер приказа</th>
	<th>Дата приказа</th>
	<th>ФИО</th>
	<th>Доп. информация</th>
	<th><?php __('Действия');?></th>
</tr>
<?php
$i = 0;
foreach ($orders as $order):
$i++;
?>
	<tr>
		<td>
			<?php echo $i; ?>
		</td>
		<td>
			<?php echo $order['Ordertype']['name']; // $html->link($order['Ordertype']['name'], array('controller' => 'ordertypes', 'action' => 'view', $order['Ordertype']['id'])); ?>
		</td>
		<td>
			<?php echo $order['Order']['number']; ?>
		</td>
		<td>
			<?php echo $order['Order']['date']; ?>
		</td>
		<td>
			<?php echo $html->link($order['Student']['lastname'].' '.$order['Student']['firstname'].' '.$order['Student']['surname'], array('controller' => 'studentinfos', 'action' => 'showinfo', $order['Student']['id'])); ?>
		</td>
		<td>
			<?php echo $order['Order']['order_info']; ?>
		</td>
		<td class="actions">
			<?php // echo $html->link(__('View', true), array('action' => 'view', $order['Order']['id'])); ?>
			<?php  echo $html->link(__('Редактровать', true), array('action' => 'edit', $order['Order']['id'])); ?> | 
			<?php echo $html->link(__('Удалить', true), array('action' => 'delete', $order['Order']['id']), null, sprintf(__('Вы действительно хотите удаль приказ с id # %s?', true), $order['Order']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
</table>

<?php
// debug ($orders);
?>